package  
{
	/**
	 * ...
	 * @author DarkGoodWIN
	 */
	public class TRequestListener
	{
		private var ExtOnComplete: Function = null;
		private var fGameInfo: TGameInfo = null;
		private var fBlockGUI: Boolean = true;
		
		public function OnComplete(O: Object): void
		{
			if (ExtOnComplete != null)
				ExtOnComplete(O);
			if (fBlockGUI)
				fGameInfo.RemoveRequest();
		}
		
		public function onFail(data: Object): void 
		{
			if (fBlockGUI)
				fGameInfo.RemoveRequest();
			var Err: String;
			try
			{
				Err = data.error_msg;
			}
			catch (e: Error)
			{
				Err = "Ошибка сервера";
			}
			new TModalMessage(Err);
			trace(Err);
		}
		
		public function TRequestListener(aGameInfo: TGameInfo, anonComplete:Function, aBlockGUI: Boolean = true) 
		{
			ExtOnComplete = anonComplete;
			fGameInfo = aGameInfo;
			fBlockGUI = aBlockGUI;
		}
		
	}

}